package main

import (
	"fmt"
	"time"
)

/*有限次循环*/
func main091() {
	//for i := 1; i < 11; i++ {
	//	fmt.Println(i)
	//}
	//for i := 10; i > 0; i-- {
	//	fmt.Println(i)
	//}
	//for i := 2; i < 12; i+=2 {
	//	fmt.Println(i)
	//}
	for i := 9; i > 0; i -= 2 {
		fmt.Println(i)
	}
	fmt.Println("GAME OVER!")
}

/*无限次循环*/
func main092() {
	for {
		fmt.Println("我爱撸代码")
		time.Sleep(1 * time.Second)
	}
}

/*退出循环*/
func main093() {
	var count = 0
	for {
		if count%2 == 1 {
			fmt.Println("我爱撸代码")
		} else {
			fmt.Println("我爱撩妹")
		}

		count ++
		time.Sleep(500 * time.Millisecond)

		if count >= 10 {
			//跳出循环
			break
		}
	}
	fmt.Println("game over")
}

/*每天撸代码，逢5就休息*/
func main094() {
	var count = 0
	for {
		count ++
		if count % 5 == 0{
			//忽略本次循环，进入下一次循环
			continue
		}

		/*正常的循环逻辑*/
		fmt.Println("我爱撸代码",count)
		time.Sleep(500 * time.Millisecond)
		if count > 19 {
			//跳出循环
			break
		}
	}
	fmt.Println("game over")
}